package ast;

import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

import lexer.Position;

public abstract class ExpressionNode {

	@Override
	public String toString() {
		return "ExpressionNode [children=" + children + "]";
	}

	public Position position() {
		return position;
	}

	public List<ExpressionNode> getChildren() {
		return children;
	}

	private final Position position;
	private final List<ExpressionNode> children;

	public ExpressionNode(Position position, ExpressionNode... children) {
		this.position = position;
		this.children = Arrays.asList(children);
	}

	public ExpressionNode(Position position,
			Collection<? extends ExpressionNode> children) {
		this.position = position;
		this.children = Collections.unmodifiableList((List<? extends ExpressionNode>) children);
	}
	
	public abstract long collapseExp() throws Exception;

}
